package com.hibuy.pc.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * 启动项目默认实现的方法
 * Created by admin on 2017/12/22.
 */
@Configuration
public class DefaultView extends WebMvcConfigurerAdapter {


    /**
     * 设置默认启动方法
     * @param registry
     */
    @Override
    public void addViewControllers (ViewControllerRegistry registry){
        registry.addViewController("/").setViewName("forward:/Login");
        registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
        super.addViewControllers(registry);
    }

    /**
     * 配置访问静态资源
     * @param registry
     */
    @Override
    public void addResourceHandlers (ResourceHandlerRegistry registry){
        //registry.addResourceHandler("/**").addResourceLocations("classpath:/resources/main/static/images/");
        super.addResourceHandlers(registry);
    }






}
